not selector
Description: Selects all elements that do not match the given selector.
-
version added: 1.0jQuery( ":not(selector)" )
selector: A selector with which to filter by.
All selectors are accepted inside :not()
, for example: :not(div a)
and :not(div,a)
.
Additional Notes
The .not()
method will end up providing you with more readable selections than pushing complex selectors or variables into a :not()
selector filter. In most cases, it is a better choice.
Example:
Finds all inputs that are not checked and highlights the next sibling span. Notice there is no change when clicking the checkboxes since no click events have been linked.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
|